home *** CD-ROM | disk | FTP | other *** search
/ Macworld Expo - Develope…Central & Net Innovations / Developer Central and Net Innovators (MacWorld Expo) (January 1999).iso / Developer Central / Bowers Development / Demo AppMaker / Examples / plain C OS8 / AMReminder / AMReminderEngine.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-29  |  2.4 KB  |  119 lines  |  [TEXT/CWIE]

  1. /* AMReminderEngine.c -- application-specific data management */
  2.  
  3. /* This module contains data structures to access the data in your */
  4. /* document's file(s). The purpose is to isolate the details of the */
  5. /* data representation into this module and to provide accessor */
  6. /* functions for reading/writing logical pieces of the data. */
  7. /* For your application, you will probably rewrite most of this. */
  8. /* This module will not be regenerated by AppMaker unless you delete it. */
  9.  
  10. #include <Types.h>
  11. #include <Quickdraw.h>
  12. #include <Controls.h>
  13. #include <Events.h>
  14. #include <Lists.h>
  15. #include <Menus.h>
  16. #include <TextEdit.h>
  17. #include <stdlib.h>
  18.  
  19. #include "Dispatcher.h"
  20. #include "DReminder.h"
  21. #include "DDocData.h"
  22. #include "Globals.h"
  23. #include "Miscellany.h"
  24. #include "AMReminderEngine.h"
  25.  
  26.  
  27. //----------
  28. AMReminderEngine*        NewAMReminderEngine ()
  29. {
  30.     AMReminderEngine*        engine;
  31.  
  32.     engine = (AMReminderEngine*)malloc (sizeof (AMReminderEngine));
  33.     AMReminderEngine_Init (engine);
  34.     SetClassID (engine, classAMReminderEngine);
  35.  
  36.     return engine;
  37. }
  38.  
  39. //----------
  40. void    DeleteEngine (
  41.     AMEngine*        engine)
  42. {
  43.     AMReminderEngine_Free ((AMReminderEngine*)engine);
  44.     free (engine);
  45. }
  46.  
  47. //----------
  48. void    AMReminderEngine_Init (
  49.     AMReminderEngine*        self)
  50. {
  51.     AMEngine_Init ((AMEngine*) self);
  52.  
  53.     self->super.mFileType = kFileType;
  54.     self->super.mSignature = kSignature;
  55. }
  56.  
  57. //----------
  58. void    AMReminderEngine_Free (
  59.     AMReminderEngine*        self)
  60. {
  61.     AMEngine_Free ((AMEngine*) self);
  62. }
  63.  
  64. // These are just models for your own data access functions.
  65. // Replace them with ones that do something useful.
  66.  
  67. /*----------*/
  68. DReminder*    GetReminder (
  69.     AMReminderEngine*        self)
  70. {
  71.     return NewDReminder ();
  72. }
  73.  
  74. /*----------*/
  75. DDocData*    GetDocData (
  76.     AMReminderEngine*        self)
  77. {
  78.     return NewDDocData ();
  79. }
  80.  
  81. //----------
  82. void    InitData (
  83.     AMEngine*        engine)
  84. {
  85.     AMReminderEngine*        self = (AMReminderEngine*) engine;
  86.  
  87.     // override to initialize your data structures
  88. }
  89.  
  90. //----------
  91. void    DisposeData (
  92.     AMEngine*        engine)
  93. {
  94.     AMReminderEngine*        self = (AMReminderEngine*) engine;
  95.  
  96.     // override to dispose your data structures
  97. }
  98.  
  99. //----------
  100. void    ReadFile (
  101.     AMEngine*        engine)
  102. {
  103.     AMReminderEngine*        self = (AMReminderEngine*) engine;
  104.  
  105.     InitData (engine);
  106.     engine->mDirty = false;
  107.     // override to read from the current file into your data structures
  108. }
  109.  
  110. //----------
  111. void    WriteFile (
  112.     AMEngine*        engine)
  113. {
  114.     AMReminderEngine*        self = (AMReminderEngine*) engine;
  115.  
  116.     engine->mDirty = false;
  117.     // override to write your data structures to the current file
  118. }
  119.